package com.hezuti.common.action;

import org.apache.commons.lang.math.NumberUtils;
import org.apache.struts2.ServletActionContext;

import com.hezuti.common.page.PageInfo;




/**
 * @author jianbo.zhu
 * 
 */
@SuppressWarnings("serial")
public class PageAction extends BaseAction {

	private PageInfo page = new PageInfo();

	/**
	 * 重写父类方法
	 * 
	 */
	public void prepare() throws Exception {
		super.prepare();
		int currentPageNo = NumberUtils.toInt(ServletActionContext.getRequest().getParameter(PageInfo.CURRENT_PAGE_NAME));
		currentPageNo = currentPageNo < PageInfo.FIRST_PAGE_NO ? PageInfo.FIRST_PAGE_NO : currentPageNo;
		page.setCurrentPageNo(currentPageNo);
	}

	/**
	 * 
	 * @return
	 */
	public PageInfo getPage() {
		return page;
	}

	/**
	 * 
	 * @param page
	 */
	public void setPage(PageInfo page) {
		this.page = page;
	}

}
